home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / What's New? / Development Kits / Mac OS / USB DDK 1.4.6f4 / Examples / PrinterClassDriver / PrintChooserSample / ChooserPACK.r < prev    next >
Encoding:
Text File  |  2000-09-25  |  9.5 KB  |  350 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ChooserPACK.r
  3.  
  4.     Contains:    Rsrc description to build the PACK header and other rsrcs
  5.                 needed by the PACK code
  6.  
  7.  
  8.  
  9.     Copyright:    © 1998, 2000 by Apple Computer, Inc., all rights reserved.
  10.  
  11.     Writers:
  12.  
  13.         (gc)    Garth Cummings
  14.  
  15.     Change History (most recent first):
  16.  
  17.       <USB1>     5/11/00    gc        first checked in
  18.         21 Mar 98     gp        Added
  19.  
  20.     To Do:
  21. */
  22.  
  23. /***********************************************************************************/
  24. /****  Includes                                                                    ****/
  25. /***********************************************************************************/
  26. #ifndef __CHOOSERPACK__
  27. #define __CHOOSERPACK__
  28.  
  29. #ifndef __COMMON__
  30. #include "Common.h"
  31. #endif
  32.  
  33. #ifndef __SYSTYPES_R__
  34. #include "Types.r"                /* To get system types */
  35. #endif
  36.  
  37. #ifndef __SYSTYPES_R__
  38. #include "SysTypes.r"
  39. #endif
  40.  
  41. /***********************************************************************************/
  42. /****  PACK                                                                        ****/
  43. /***********************************************************************************/
  44. /*
  45.  * When building a PACK resource, insert the line:
  46.  *
  47.  *        type 'PACK' as 'PACW';
  48.  *
  49.  * in your resource file before your "resource 'PACK' ..." declaration.
  50.  */
  51.  
  52. type 'PACW' {
  53.     unsigned integer    = $600e;        /* bra.s to offset $e        */
  54.     unsigned integer    = 0;            /* device ID (Usually 0)    */
  55.     literal longint        = 'PACK';        /* res type, always PACK    */
  56.     integer                = kPACKID;        /* res ID always -4096        */
  57.     integer;                            /* version of driver        */
  58.  
  59.     /*
  60.     Values for flags obtained from Chooser source code file RDEVEqu.a and
  61.     IM Devices, pp 1-46…
  62.     */
  63.     boolean notAppleTalkDev,        appleTalkDev;        /* 31:Appletalk device?        */
  64.     boolean notPAPDev,                papDev;                /* 30:Printer Access Protocol device? */
  65.     boolean notPostScriptDev,        postScriptDev;        /* 29:PostScript device?        */
  66.     boolean noMultiples,            multiples;            /* 28:multiple selections?        */
  67.     boolean noLeftButton,            leftButton;            /* 27:uses left button            */
  68.     boolean noRightButton,            rightButton;        /* 26:uses right button        */
  69.     boolean saveZone,                dontSaveZone;        /* 25:saved zone name            */
  70.     boolean doesntUseZones,            usesZones;            /* 24:uses zone names name        */
  71.     boolean intlChars,                noIntlChars;        /* 23:Translate int'l chars to U.S.? */
  72.     boolean noEvenName,                evenName;            /* 22:Is this a LaserWriter? */
  73.     boolean noLengthOnRename,        lengthOnRename;        /* 21:Pass length byte in Rename name? */
  74.     boolean noOnOff,                onOff;                /* 20:Device uses on/off radio buttons. */
  75.     boolean selfSend,                dontSelfSend;        /* 19:Receive info from this machine? */
  76.     boolean = 0;                                        /* 18:reserved                    */
  77.     boolean doesntAcceptInit,        acceptsInit;        /* 17:accepts Initialize msg    */
  78.     boolean doesntAcceptNewSel,        acceptsNewSel;        /* 16:accepts newSel msg        */
  79.     boolean doesntAcceptFillList,    acceptsFillList;    /* 15:accepts FillList msg        */
  80.     boolean doesntAcceptGetSel,        acceptsGetSel;        /* 14:accepts GetSel msg        */
  81.     boolean doesntAcceptSelect,        acceptsSelect;        /* 13:accepts Select msg        */
  82.     boolean doesntAcceptDeselect,    acceptsDeselect;    /* 12:accepts Deselect msg        */
  83.     boolean doesntAcceptTerm,        acceptsTerm;        /* 11:accepts Terminate msg        */
  84.     boolean doesntAcceptRename,        acceptsRename;        /* 10:accepts Rename msg        */
  85.     boolean = 0;                                        /*  9:reserved                    */
  86.     boolean = 0;                                        /*  8:reserved                    */
  87.     boolean = 0;                                        /*  7:reserved                    */
  88.     boolean = 0;                                        /*  6:reserved                    */
  89.     boolean = 0;                                        /*  5:reserved                    */
  90.     boolean = 0;                                        /*  4:reserved                    */
  91.     boolean = 0;                                        /*  3:reserved                    */
  92.     boolean = 0;                                        /*  2:reserved                    */
  93.     boolean = 0;                                        /*  1:reserved                    */
  94.     boolean packExists,                noPackage;            /*  0:Is the Package really there? */
  95.  
  96.     /*
  97.     The PACK code is inserted here by Rez. Use the $$Resource() directive…
  98.     */
  99.     hex string;
  100. };
  101.  
  102. type 'CTYP' {
  103.     unsigned integer    = 0;        /* type of connection for selected printer 0-none 1-serial 2-UBB */
  104.     unsigned integer doesntSupportSerial,        supportsSerial;
  105.     unsigned integer doesntSupportUSB,            supportsUSB;
  106. };
  107.  
  108. /*
  109. *    What connection types we support and the type of connection for the selected printer
  110. */
  111. resource 'CTYP'(1000, purgeable ) {
  112.     supportsSerial,
  113.     supportsUSB
  114. };
  115.  
  116. /*
  117. *    Path in name registry for the printer models this driver supports
  118. */
  119. resource 'STR#'(1000, purgeable ) {
  120.     {
  121.     "Devices:device-tree:PRINTER:Color StyleWriter 6500",
  122.     "Devices:device-tree:PRINTER:DeskJet 870C",
  123.     }
  124. };
  125.  
  126. /*
  127. *    Path in name registry for the last selected usb printer
  128. *    The code should not change the size of the rsrcs. 
  129. *    Therefore this rsrc must be kepted at a fixed length 
  130. *    size of 256 bytes!
  131. */
  132.  
  133. data 'STR ' (2000, purgeable) {
  134.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  135.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  136.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  137.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  138.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  139.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  140.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  141.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  142.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  143.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  144.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  145.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  146.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  147.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  148.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  149.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  150. };
  151.  
  152. /*
  153. *    Name of last selected usb printer
  154. *    The code should not change the size of the rsrcs. 
  155. *    Therefore this rsrc must be kepted at a fixed length 
  156. *    size of 256 bytes!
  157. */
  158.  
  159. data 'STR ' (2100, purgeable) {
  160.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  161.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  162.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  163.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  164.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  165.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  166.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  167.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  168.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  169.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  170.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  171.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  172.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  173.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  174.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  175.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  176. };
  177.  
  178. /*
  179. *    Color table for no Name Registry alert dialog
  180. */
  181. resource 'actb' (3000) {
  182.     {    /* array ColorSpec: 5 elements */
  183.         /* [1] */
  184.         wContentColor, 65535, 65535, 65535,
  185.         /* [2] */
  186.         wFrameColor, 0, 0, 0,
  187.         /* [3] */
  188.         wTextColor, 0, 0, 0,
  189.         /* [4] */
  190.         wHiliteColor, 0, 0, 0,
  191.         /* [5] */
  192.         wTitleBarColor, 65535, 65535, 65535
  193.     }
  194. };
  195.  
  196. /*
  197. *    Alert used when Name Registry isnt present
  198. */
  199. resource 'ALRT' (3000) {
  200.     {50, 30, 180, 430},
  201.     3000,
  202.     {    /* array: 4 elements */
  203.         /* [1] */
  204.         OK, visible, sound1,
  205.         /* [2] */
  206.         OK, visible, sound1,
  207.         /* [3] */
  208.         OK, visible, sound1,
  209.         /* [4] */
  210.         OK, visible, sound1
  211.     }
  212.     ,alertPositionMainScreen
  213. };
  214.  
  215. /*
  216. *    DITL for alert
  217. */
  218. resource 'DITL' (3000) {
  219.     {    /* array DITLarray: 2 elements */
  220.         /* [1] */
  221.         {97, 313, 117, 387},
  222.         Button {
  223.             enabled,
  224.             "OK"
  225.         },
  226.         /* [2] */
  227.         {13, 74, 84, 387},
  228.         StaticText {
  229.             disabled,
  230.             "The Name Registry is missing from this c"
  231.             "omputer. It is required by this driver t"
  232.             "o function properly."
  233.         }
  234.     }
  235. };
  236.  
  237. /*
  238. *    Color table for printer not available alert dialog
  239. */
  240. resource 'actb' (3100) {
  241.     {    /* array ColorSpec: 5 elements */
  242.         /* [1] */
  243.         wContentColor, 65535, 65535, 65535,
  244.         /* [2] */
  245.         wFrameColor, 0, 0, 0,
  246.         /* [3] */
  247.         wTextColor, 0, 0, 0,
  248.         /* [4] */
  249.         wHiliteColor, 0, 0, 0,
  250.         /* [5] */
  251.         wTitleBarColor, 65535, 65535, 65535
  252.     }
  253. };
  254.  
  255. /*
  256. *    Alert used when Name Registry isnt present
  257. */
  258. resource 'ALRT' (3100) {
  259.     {50, 30, 180, 430},
  260.     3100,
  261.     {    /* array: 4 elements */
  262.         /* [1] */
  263.         OK, visible, sound1,
  264.         /* [2] */
  265.         OK, visible, sound1,
  266.         /* [3] */
  267.         OK, visible, sound1,
  268.         /* [4] */
  269.         OK, visible, sound1
  270.     }
  271.     ,alertPositionMainScreen
  272. };
  273.  
  274. /*
  275. *    DITL for alert
  276. */
  277. resource 'DITL' (3100) {
  278.     {    /* array DITLarray: 2 elements */
  279.         /* [1] */
  280.         {97, 313, 117, 387},
  281.         Button {
  282.             enabled,
  283.             "OK"
  284.         },
  285.         /* [2] */
  286.         {13, 74, 84, 387},
  287.         StaticText {
  288.             disabled,
  289.             "The previously selected printer cannot b"
  290.             "e found. Please make sure the printer is"
  291.             " on, check the connections or make anoth"
  292.             "er selection."
  293.         }
  294.     }
  295. };
  296.  
  297.  
  298. /*
  299.  * This will produce a PACK resource from the special PACW type.
  300.  * (this eliminates the need for using the Assembler to create
  301.  *    the DA header, but makes it impossible to use SADE, oops!)
  302.  *
  303.  */
  304.  
  305. type 'PACK' as 'PACW';            /* Map 'PACW' => 'PACK' */
  306.  
  307. resource 'PACK' (kPACKID, purgeable) {
  308.     /*
  309.      * device version
  310.      */
  311.     3,
  312.     
  313.     /*
  314.      * PACK flags
  315.      */
  316.     notAppleTalkDev,        /* non appletalk device            */
  317.     notPAPDev,                /* non PAP device                */
  318.     notPostScriptDev,        /* non PostScript device        */
  319.     noMultiples,            /* multiple instances            */
  320.     noLeftButton,            /* use left button                */
  321.     noRightButton,            /* use right button                */
  322.     dontSaveZone,            /* save zone name                */
  323.     doesntUseZones,            /* uses zone names name            */
  324.     intlChars,                /* let international chars through */
  325.     noEvenName,                /* not a LaserWriter; leave the name alone */
  326.     noLengthOnRename,        /* don't send the length byte with the name */
  327.     noOnOff,                /* doesn't use on/off button    */
  328.     selfSend,                /* not really relevant            */
  329.     acceptsInit,            /* Accepts the Initialize msg    */
  330.     doesntAcceptNewSel,        /* no newSel msg                */
  331.     acceptsFillList,        /* FillList msg                    */
  332.     acceptsGetSel,            /* accepts GetSel msg            */
  333.     acceptsSelect,            /* accepts Select msg            */
  334.     acceptsDeselect,        /* Deselect msg                    */
  335.     acceptsTerm,            /* accept Terminate msg            */
  336.     doesntAcceptRename,        /* doesn't accept rename msg    */
  337.     packExists,                /* package really exists        */
  338.  
  339.     /*
  340.      * This directive inserts the contents of the PACW resource
  341.      * with our PACK code
  342.      */
  343.     #ifdef __MPW__
  344.         $$Resource("::ChsrPACW.rsrc", 'PACW', 0)
  345.     #else
  346.         $$Resource("ChsrPACW.rsrc", 'PACW', 0)
  347.     #endif
  348. };
  349.  
  350. #endif